<template>
	<view class="details-view">
		<view class="details-tit">
			{{detailsForm.titleName}}
		</view>
		<view class="details-msg">
			<view class="author">
				作者：<text>{{detailsForm.author || '-'}}</text>
			</view>
			<view class="publish">
				发布：<text>{{detailsForm.releaseTime}}</text>
			</view>
		</view>
		<view class="pdfView">
			<web-view
				src="http://videodocument1.obs.cn-north-9.myhuaweicloud.com/health/20231201/20231201092544661600.pdf"></web-view>
		</view>
		<view class="look-over">
			<uni-icons type="eye" size="30"></uni-icons>
			<view class="look-tit" style="margin-right: 200rpx;">浏览量（333）</view>
			<uni-icons type="star" size="30"></uni-icons>
			<view class="look-tit" style="margin-right: 40rpx;">收藏</view>
			<uni-icons type="redo" size="30"></uni-icons>
			<view class="look-tit">分享</view>
		</view>
		<!-- 	<view style="margin: 20rpx 0;">相关推荐
		</view>
		<view class="recommend">
			<view class="recommend-item" v-for="item in list">
				<img class="recommend-img" src="../../static/img/tuijian.jpg" alt="">
				<view class="recommend-tit">
					糖尿病会造成急性或慢性并发症
				</view>
			</view>
		</view> -->
		<!-- <view class="review">
			<view class="review-top">
				<view class="review-left">
					评论（344）
				</view>
				<view class="review-icon">
					<uni-icons type="compose" size="30"></uni-icons>
				</view>
				<view class="review-right">
					参与评论
				</view>
			</view>
			<view class="review-list" v-for="i in 4">
				<img class="review-img" src="http://139.224.68.50:9017/file/18114b7680374a7b806e962aea7859b7.jpg"
					alt="">
				<view class="content">
					<view class="content-top">
						<view class="user-name">
							微信用户
						</view>
						<view class="review-time">
							2023-10-10
						</view>
					</view>
					<view class="review-content">
						金秋的阳光温馨安静，金秋的微风和煦温柔，金秋的蓝天白云飘逸，金秋的田野遍地金黄。在这个硕果累累的季节
					</view>
				</view>
			</view>
		</view> -->
	</view>
</template>

<script>
	import uParse from '../../components/u-parse/u-parse.vue'
	import * as topNewsList from '../../common/api/topNewsList.js'
	export default {
		components: {
			uParse
		},
		data() {
			return {
				uid: '',
				list: [1, 2, 3, 4],
				detailsForm: {},
				url: ''
			};
		},
		onLoad(e) {
			this.uid = e.uid
			this.getData()
		},
		methods: {
			getData() {
				let param = {
					uid: this.uid
				}
				topNewsList.queryById(param).then(res => {
					this.detailsForm = res.data.data
					this.url = '/hybrid/html/web/viewer.html?file=' + encodeURIComponent(
						'http://videodocument1.obs.cn-north-9.myhuaweicloud.com/health/20231201/20231201092544661600.pdf'
					)
					// uni.downloadFile({
					// 	url: 'http://videodocument1.obs.cn-north-9.myhuaweicloud.com/health/20231201/20231201092544661600.pdf',
					// 	success: function(res) {
					// 		var filePath = res.tempFilePath;
					// 		uni.openDocument({
					// 			filePath: filePath,
					// 			success: function(res) {
					// 				console.log("打开文档成功");
					// 			},
					// 		});
					// 	},
					// });
				}).catch(error => {
					console.log(error)
				})
			}
		}
	}
</script>

<style lang="scss">
	.details-view {
		padding: 50rpx 20rpx;

		.details-tit {
			text-align: center;
			font-size: 40rpx
		}

		.details-msg {
			display: flex;
			justify-content: space-between;
			font-size: 24rpx;
			margin-top: 30rpx;
		}

		.look-over {
			display: flex;
			font-size: 24rpx;
			line-height: 40rpx;
			margin: 20rpx 0;

			.look-tit {
				margin-bottom: 10rpx;
			}

			.uni-icons {
				font-size: 24rpx;
			}
		}

		.recommend {
			width: 710rpx;
			display: flex;
			gap: 40rpx;
			overflow-x: scroll;

			.recommend-item {
				width: 200rpx;

				.recommend-img {
					width: 200rpx;
					height: 140rpx;
					border-radius: 20rpx;
				}

				.recommend-tit {
					width: 200rpx;
					overflow: hidden;
					white-space: nowrap;
					text-overflow: ellipsis;
				}
			}

		}

		.review {
			width: 710rpx;
			margin-top: 40rpx;

			.review-top {
				position: relative;
				height: 80rpx;

				.review-left {
					position: absolute;
					left: 0;
				}

				.review-icon {
					position: absolute;
					top: -16rpx;
					right: 160rpx;
				}

				.review-right {
					position: absolute;
					right: 0;
				}
			}

			.review-list {
				display: flex;
				gap: 20rpx;
				margin-bottom: 40rpx;

				.review-img {
					width: 80rpx;
					height: 80rpx;
					border-radius: 40rpx;
				}

				.content {
					width: 580rpx;

					.content-top {
						position: relative;
						height: 60rpx;
						width: 580rpx;

						.user-name {
							position: absolute;
							left: 0;
						}

						.review-time {
							position: absolute;
							right: 0;
						}
					}

					.review-content {
						display: -webkit-box;
						-webkit-line-clamp: 2;
						-webkit-box-orient: vertical;
						overflow: hidden;
					}
				}
			}
		}
	}

	.richText {
		margin: 20rpx;
		width: 670rpx;
	}

	video {
		display: block;
		margin: 20rpx auto;
		width: 710rpx;
	}
</style>